package com.dengyafei.config;




import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.impl.model.jdbc.MySQLJDBCDataModel;
import org.apache.mahout.cf.taste.model.DataModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 邓亚非
 */
@Configuration
public class RecommendConfig {

    @Bean
    public DataModel getModel() throws TasteException {
        MysqlDataSource dataSource=new MysqlDataSource();
        dataSource.setServerName("localhost");
        dataSource.setDatabaseName("recommend");
        dataSource.setUser("root");
        dataSource.setPassword("root");
        return new MySQLJDBCDataModel(dataSource,"prefer","gid","pid","lval","time");
    }
}